package io.renren.modules.dangan.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.dangan.dao.TBpxmDao;
import io.renren.modules.dangan.entity.TBpxmEntity;
import io.renren.modules.dangan.service.TBpxmService;


@Service("tBpxmService")
public class TBpxmServiceImpl extends ServiceImpl<TBpxmDao, TBpxmEntity> implements TBpxmService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String xmbh= (String) params.getOrDefault("xmbh","");
        String pfwh= (String) params.getOrDefault("pfwh","");
        String pzwh= (String) params.getOrDefault("pzwh","");
        String xmmc= (String) params.getOrDefault("xmmc","");
        IPage<TBpxmEntity> page = this.page(
                new Query<TBpxmEntity>().getPage(params),
                new QueryWrapper<TBpxmEntity>()
                        .like(StringUtils.isNotBlank(pfwh), "pf_wh", pfwh)
                        .like(StringUtils.isNotBlank(xmbh), "xm_bh", xmbh)
                        .like(StringUtils.isNotBlank(pzwh), "s_pz_wh", pzwh)
                        .like(StringUtils.isNotBlank(xmmc), "xm_mc", xmmc)
        );

        return new PageUtils(page);
    }

}
